package com.lixinwen.gdgame.game.util;

public class Checker {
    public static boolean isStraightFlush(int[] cards,Integer rank){
        if(cards.length!=5){
            return false;
        }
        int base = cards[0];
        for(int i=0;i<5;i++){
            if(cards[i]!=base+i&&cards[i]!=12+rank){
                if(base%13==10&&i==4){
                    return cards[4]+14 == base+4;
                }
                return false;
            }
        }
        return true;
    }

    public static boolean isStraight(int[] cards,Integer rank){
        int base = cards[0]%13;
        for(int i=0;i<5;i++){
            if(cards[i]%13!=base+i&&cards[i]!=12+rank){
                if(base==10&&i==4){
                    return cards[4]%13==0;
                }
                return false;
            }
        }
        return !isStraightFlush(cards,rank);
    }
}
